package com.gosophia.util;


import java.util.Locale;

import freemarker.cache.ClassTemplateLoader;
import freemarker.template.Configuration;
import freemarker.template.DefaultObjectWrapper;
import freemarker.template.TemplateExceptionHandler;

public class FreemarkerManage {

	private static String ENCODING="UTF-8";
	private static Configuration cfg=new Configuration();
	static{
		//定义模板的位置
		cfg.setTemplateLoader(new ClassTemplateLoader(FreemarkerManage.class,"templates"));
		cfg.setObjectWrapper(new DefaultObjectWrapper());
		//设置异常
		cfg.setTemplateExceptionHandler(TemplateExceptionHandler.IGNORE_HANDLER);
		cfg.setEncoding(Locale.CHINA, ENCODING);
	}
	public static Configuration getConfiguration(){
		return cfg;
	}

}
